*/ private $storage = []; /** * @return null|mixed */ public function load(string $key, string $variableKey) { if (!isset($this->storage[$key])) { return null; } $item = $this->storage[$key]; if (!$item->isVariableKeyValid($variableKey)) { return null; } return $item->getData(); } /** * @param mixed $data */ public function save(string $key, string $variableKey, $data) : void { $this->storage[$key] = new CacheItem($variableKey, $data); } public function clean(string $key) : void { if (!isset($this->storage[$key])) { return; } unset($this->storage[$key]); } public function clear() : void { $this->storage = []; } }